//
//  AdView.m
//  WidgetDemo
//
//  Created by 航汇聚科技 on 2017/12/21.
//  Copyright © 2017年 Yi Zhou. All rights reserved.
//

#import "AdView.h"

@interface AdView()

@property (weak, nonatomic) IBOutlet UIImageView *adImage;
@property (weak, nonatomic) IBOutlet UIButton *countTimeBtn;


@end

@implementation AdView

- (void)awakeFromNib {
    [super awakeFromNib];
    
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    [self.countTimeBtn setTitle:[NSString stringWithFormat:@"跳过%ds",totalTime] forState:UIControlStateNormal];
    //设置3秒定时触发
    [NSTimer scheduledTimerWithTimeInterval:3 target:self selector:@selector(colseLaunchScreen) userInfo:nil repeats:YES];
}

static int totalTime = 2;
- (void)colseLaunchScreen {
    totalTime--;
    [self.countTimeBtn setTitle:[NSString stringWithFormat:@"跳过%ds",totalTime] forState:UIControlStateNormal];
    if (totalTime <= 0 && self.superview) {
        [self removeFromSuperview];
        [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
    }
}


@end
